﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;
using Enterprise.DataFactory;
using Enterprise.Model.CaiWu;
using Enterprise.Infrastructure;
namespace Enterprise.Data.CaiWu
{
    public class CwZbkhData
    {

        /// <summary>
        ///  数据列表
        /// </summary>
        /// <returns></returns>
        public List<CwZbkhEntity> CwZbkhList()
        {
            List<CwZbkhEntity> list = new List<CwZbkhEntity>();
            string cmd = "Select * from CWB_ZBKH";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                CwZbkhEntity entity = new CwZbkhEntity();
                if (!Convert.IsDBNull(dr["KHID"])) entity.KHID = Convert.ToInt32(dr["KHID"]);
                if (!Convert.IsDBNull(dr["ZBID"])) entity.ZBID = Convert.ToInt32(dr["ZBID"]);
                if (!Convert.IsDBNull(dr["KYEAR"])) entity.KYEAR = Convert.ToInt32(dr["KYEAR"]);
                if (!Convert.IsDBNull(dr["KMONTH"])) entity.KMONTH = Convert.ToInt32(dr["KMONTH"]);
                if (!Convert.IsDBNull(dr["KDW"])) entity.KDW = Convert.ToString(dr["KDW"]);
                if (!Convert.IsDBNull(dr["KJHS"])) entity.KJHS = Convert.ToDecimal(dr["KJHS"]);
                if (!Convert.IsDBNull(dr["KSJS"])) entity.KSJS = Convert.ToDecimal(dr["KSJS"]);
                if (!Convert.IsDBNull(dr["KQZ"])) entity.KQZ = Convert.ToDecimal(dr["KQZ"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 数据操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void CwZbExecute(string cmd)
        {
            DbExecute.Execute(cmd);
        }

    }
}
